
def count_longest_word(filename):
    try:
        with open(filename, 'r') as f:
            words = f.read().split()

        longest_word = ''
        for word in words:
            if len(word) > len(longest_word):
                longest_word = word

        return longest_word
    except FileNotFoundError:
        print(f"File {filename} not found.")
        return None

if __name__ == '__main__':
    filename = 'test.txt'
    longest_word = count_longest_word(filename)
    if longest_word:
        print(f"The longest word in {filename} is {longest_word}.")